<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>单标签的内容操作</title>
  </head>
  <body>
    用户名：<input
      type="text"
      value="小白"
      id="username"
      placeholder="输入用户名"
    />
    <button id="btn">获取/设置</button>

    <script>
      let btnEle = document.querySelector("#btn");
      btnEle.addEventListener("click", function () {
        let inputEle = document.getElementById("username");
        // console.log(inputEle.value);
        inputEle.value = "小黑";
      });
    </script>
  </body>
</html>
